const { Content, Handover, User } = require('../common/mysql.js')
const { Op } = require('sequelize')

module.exports = {
    async del(id, store_id) {
        const content = await Content.findOne({
            include: [
                {
                    model: Handover,
                    include: [
                        {
                            model: User,
                            where: {
                                store_id: {
                                    [Op.eq]: store_id
                                }
                            }
                        }
                    ]
                }
            ],
            where: {
                id: {
                    [Op.eq]: id
                }
            }
        })
        await content.destroy()
    }
}
